package cn.wbu.zyh.mapper;

import cn.wbu.zyh.annotation.AutoFill;
import cn.wbu.zyh.dto.TagPageQueryDTO;
import cn.wbu.zyh.entity.Employee;
import cn.wbu.zyh.entity.Tag;
import cn.wbu.zyh.enumeration.OperationType;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

@Mapper
public interface TagMapper {
    @Insert("insert into tag(id,name,description,created_User,created_time, updated_time) VALUES " +
            "(#{id},#{name},#{description},#{createdUser},#{createdTime}, #{updatedTime})")
    @AutoFill(OperationType.UPDATE)
    void insert(Tag tag);
    @AutoFill(OperationType.UPDATE)
    void update(Tag tag);
    Page<Tag> pageQuery(TagPageQueryDTO tagPageQueryDTO);
    @Select("SELECT * FROM tag WHERE name = #{name} AND created_user = #{createdUser}")
    Tag findByNameAndUser(@Param("name") String name, @Param("createdUser") String createdUser);
    @Delete("delete from tag where id = #{id}")
    void deleteById(Long id);
}
